package com.hongxun.budget.utils;

import android.widget.ImageView;

import com.hongxun.budget.R;
import com.hongxun.greenentity.tk.DPointEntity;
import com.hongxun.greenentity.ys.EPointEntity;

/**
 * 封装界面大段代码
 */

public class ViewUtils {

    /**
     * 设置ICON
     *
     * @param d
     * @param i
     */
    public static void setIcon(Object d, ImageView i) {
        String name = "";
        String work = "";
        if (d instanceof DPointEntity) {
            name = ((DPointEntity) d).getPPName();
            work = ((DPointEntity) d).getPPWorktype();
        } else if (d instanceof EPointEntity) {
            name = ((EPointEntity) d).getPPName();
            work = ((EPointEntity) d).getPPWorktype();
        }
        int imgRes = R.mipmap.p_gt;
        switch (name) {
            case "变压器":
                switch (work) {
                    case "新增":
                        imgRes = R.mipmap.p_byq_show;
                        break;
                    case "拆除":
                        imgRes = R.mipmap.p_byq_show_l;
                        break;
                    default:
                        imgRes = R.mipmap.p_byq_show_g;
                        break;
                }
                break;
            case "箱式变电站":
                switch (work) {
                    case "新增":
                        imgRes = R.mipmap.p_bdz_show;
                        break;
                    case "拆除":
                        imgRes = R.mipmap.p_bdz_show_l;
                        break;
                    default:
                        imgRes = R.mipmap.p_bdz_show_g;
                        break;
                }
                break;
            case "中压开关柜":
            case "开关柜":
                switch (work) {
                    case "新增":
                        imgRes = R.mipmap.p_zykgg_show;
                        break;
                    case "拆除":
                        imgRes = R.mipmap.p_zykgg_show_l;
                        break;
                    default:
                        imgRes = R.mipmap.p_zykgg_show_g;
                        break;
                }
                break;
            case "柱上开关":
                switch (work) {
                    case "新增":
                        imgRes = R.mipmap.p_zskg_show;
                        break;
                    case "拆除":
                        imgRes = R.mipmap.p_zskg_show_l;
                        break;
                    default:
                        imgRes = R.mipmap.p_zskg_show_g;
                        break;
                }
                break;
            case "无功补偿":
                switch (work) {
                    case "新增":
                        imgRes = R.mipmap.p_wgbc_show;
                        break;
                    case "拆除":
                        imgRes = R.mipmap.p_wgbc_show_l;
                        break;
                    default:
                        imgRes = R.mipmap.p_wgbc_show_g;
                        break;
                }
                break;
            case "低压开关柜":
                switch (work) {
                    case "新增":
                        imgRes = R.mipmap.p_dykgg_show;
                        break;
                    case "拆除":
                        imgRes = R.mipmap.p_dykgg_show_l;
                        break;
                    default:
                        imgRes = R.mipmap.p_dykgg_show_g;
                        break;
                }
                break;
            case "电缆分接箱":
                switch (work) {
                    case "新增":
                        imgRes = R.mipmap.p_dlfjx_show;
                        break;
                    case "拆除":
                        imgRes = R.mipmap.p_dlfjx_show_l;
                        break;
                    default:
                        imgRes = R.mipmap.p_dlfjx_show_g;
                        break;
                }
                break;
            case "搭火点":
                switch (work) {
                    case "新增":
                        imgRes = R.mipmap.p_dhd_show;
                        break;
                    case "拆除":
                        imgRes = R.mipmap.p_dhd_show_l;
                        break;
                    default:
                        imgRes = R.mipmap.p_dhd_show_g;
                        break;
                }
                break;
            case "杆塔":
                switch (work) {
                    case "新增":
                        imgRes = R.mipmap.p_gt_show;
                        break;
                    case "拆除":
                        imgRes = R.mipmap.p_gt_show_l;
                        break;
                    default:
                        imgRes = R.mipmap.p_gt_show_g;
                        break;
                }
                break;
            case "柱上变压器":
                switch (work) {
                    case "新增":
                        imgRes = R.mipmap.p_zsbyq_show;
                        break;
                    case "拆除":
                        imgRes = R.mipmap.p_zsbyq_show_l;
                        break;
                    default:
                        imgRes = R.mipmap.p_zsbyq_show_g;
                        break;
                }
                break;
            case "下户点":
                switch (work) {
                    case "新增":
                        imgRes = R.mipmap.p_xhd_show;
                        break;
                    case "拆除":
                        imgRes = R.mipmap.p_xhd_show_l;
                        break;
                    default:
                        imgRes = R.mipmap.p_xhd_show_g;
                        break;
                }
                break;
            case "表箱":
                switch (work) {
                    case "新增":
                        imgRes = R.mipmap.p_bx_show;
                        break;
                    case "拆除":
                        imgRes = R.mipmap.p_bx_show_l;
                        break;
                    default:
                        imgRes = R.mipmap.p_bx_show_g;
                        break;
                }
                break;
            case "交叉跨越":
                imgRes = R.mipmap.p_jcky_show;
                break;
            case "电缆井":
                switch (work) {
                    case "新增":
                        imgRes = R.mipmap.p_dlj_show;
                        break;
                    case "拆除":
                        imgRes = R.mipmap.p_dlj_show_l;
                        break;
                    default:
                        imgRes = R.mipmap.p_dlj_show_g;
                        break;
                }
                break;
        }
        i.setImageResource(imgRes);
    }
}
